# Makefile for installing X-windows Dmuse fonts (January 2008 versions).
#
# Thu Jun 25 15:54:05 PDT 2009
# Craig Sapp <craig@ccrma.stanford.edu>
#
# Dmuse can be used without these fonts and instead use X-windows fonts, 
# but optimal display (particularly of non-ASCII characters) will be had 
# by installing these fonts into the x-windows system.  This makefile should
# work in Linux, OS X and Cygwin.  There are several possibilities as to 
# where the X11 fonts should be installed.  This makefile will search for
# a suitable place, and print an error message if the correct location could
# not be found.
#
# To install, type "make" in a termina (without the quotes), and then 
# restart X-windows to make sure that the newly installed fonts are used.
#
# The X11 fonts must be installed on the computer which is being used
# to display the Dmuse program, not on the computer which is running
# the Dmuse (if it is being run remotely).
#

ifeq ($(shell uname),Darwin)
	MKFONTDIR = /usr/X11R6/bin/mkfontdir
else
	MKFONTDIR = mkfontdir
endif

ifneq ($(wildcard /usr/share/fonts/default/Type1),)
	# location in Fedora 11 linux 
	DEST ?= /usr/share/fonts/default/Type1
endif
ifneq ($(wildcard /usr/share/fonts/Type1),)
	# location in Gentoo linux
	DEST ?= /usr/share/fonts/Type1
endif
ifneq ($(wildcard /usr/X11R6/lib/X11/fonts/Type1),)
	# location in Apple 10.4
	DEST ?= /usr/X11R6/lib/X11/fonts/Type1
endif

ifneq ($(DEST),)
all: copy install
	@echo "Now you need to restart X-windows by typing control-alt-backspace"
install:
	-(cd $(DEST); rm fonts.dir; $(MKFONTDIR))
copy:
	cp pyrz-10x21.pcf $(DEST)
	cp pyrz-11x24.pcf $(DEST)
	cp pyrz-7x6.pcf   $(DEST)
	cp pyrz-8x12.pcf  $(DEST)
	cp pyrz-8x15.pcf  $(DEST)
	cp pyrz-9x18.pcf  $(DEST)
else
all:      message
install:  message
copy:     message
message:
	@echo Error: do not know where to store the fonts.
	@echo /usr/share/fonts/default/Type1 directory does not exist.
	@echo /usr/share/fonts/Type1 directory does not exist.
	@echo Look for a directory similar to those and update Makefile.

endif


